home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / text / tex / amiweb2c.lha / AmiWeb2c-2.1 / texmf / amiweb2c / rexx / texc.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-10-31  |  1.3 KB  |  69 lines

  1. /*
  2. **    ARexx script to transform `tex.lpro' into `texc.lpro'
  3. **
  4. **    Written by Giuseppe Ghibò <ghibo@galileo.polito.it>
  5. **    Version 1.0 (28 Sep 1994).
  6. **
  7. **    Modified by Andreas Scherer <andreas.scherer@pobox.com>
  8. **      Version 1.1 (28 Oct 1997).
  9. */
  10.  
  11. Signal On Break_C
  12. Signal On Error
  13.  
  14. Parse Arg INPUTFILE OUTPUTFILE .
  15.  
  16. If ~Open('inputfile',INPUTFILE,'Read') Then Do
  17.     Say "Can't find file '"INPUTFILE"'"
  18.     Exit 1
  19. End
  20.  
  21. If ~Open('outputfile',OUTPUTFILE,'Write') Then Do
  22.     Say "Can't open file '"OUTPUTFILE"'"
  23.     Exit 1
  24. End
  25.  
  26. mode = 'COPY'
  27.  
  28. Do While ~Eof('inputfile')
  29.  
  30.     line = ReadLn('inputfile')
  31.  
  32.     If line = "% begin code for uncompressed fonts only" Then mode = 'ADD'
  33.  
  34.     If line = "% end code for uncompressed fonts only" Then
  35.         Do
  36.             mode = 'COPY'
  37.             count = WriteCh('outputfile',"% ")
  38.         End
  39.  
  40.     If line = "% % here's the alternate code for unpacking compressed fonts" Then
  41.         mode = 'DEL'
  42.  
  43.     If line = "% % end of code for unpacking compressed fonts" Then
  44.         Do
  45.             line = SubStr(line, 3)
  46.             mode = 'COPY'
  47.         End
  48.  
  49.     Select
  50.         when mode = 'COPY' Then count = WriteLn('outputfile', line)
  51.  
  52.         when mode = 'ADD' Then count = WriteLn('outputfile', "% " || line)
  53.  
  54.         when mode = 'DEL' Then count = WriteLn('outputfile', SubStr(line,3))
  55.     End
  56. End
  57.  
  58. result = Close('inputfile')
  59. result = Close('outputfile')
  60.  
  61. Exit 0
  62.  
  63. Break_C:
  64.     Say 'Break detected at line' SIGL
  65.     Exit
  66.  
  67. Error:
  68.     Say 'Error detected at line' SIGL
  69.